<link rel="stylesheet" href="/static/dist/css/AdminLTE.min.css" type="text/css">
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="/static/plugins/datatables/jquery.dataTables.css" type="text/css">
<link rel="stylesheet" href="/static/css/admin.css" type="text/css">
<link rel="stylesheet" href="/static/jBox/Skins/Metro/jbox.css" type="text/css">
<link rel="stylesheet" href="/static/plugins/daterangepicker/daterangepicker.css" type="text/css">
<link rel="stylesheet" href="/static/plugins/datepicker/datepicker3.css" type="text/css">
<style>
    .dataTables_length{
        margin-top: 10px;
    }
    .dataTable>tbody>tr>td{
        vertical-align: middle;
        font-size: 0.8em;
        padding: 8px 18px;
    }
    .dataTable>thead>tr>th{
        vertical-align: middle;
        font-size: 0.8em;
    }
</style>
<div class="tabs-panel">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <label>模板名称：</label>
                    <input class="depart-input" name="search_template_title" id="search_template_title" type="text" placeholder="" style="width: 150px">&nbsp;
                    <button type="button" class="btn btn-primary depart-modal" onclick="table_list_reload()" style="width: 100px;">查询</button> &nbsp;
                    <button type="button" class="btn btn-warning depart-modal" id="reset_button" style="width: 100px;">重置</button>
                </div>
                <div class="box-body">
                    <button type="button" class="btn btn-success depart-modal" id="add_button" style="width: 100px;">添加</button>
                    <table id="table_list" class="display">
                        <thead>
                            <tr>
                                <th style="width: 10%">操作</th>
                                <th style="width: 5%">ID</th>
                                <th style="width: 30%">模板名称</th>
                                <th style="width: 20%">模板别名</th>
                                <th style="width: 10%">类型</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="template-modal" style="background: rgba(236, 230, 230, 0.3);" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 50%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">添加热销商品</h4>
            </div>
            <div class="modal-body">
                <form action="/sys-message/change-message-template" method="post" name="template_form" id="template_form">
                    <div class="box-body">
                        <div class="form-group">
                            <label for="tag_group_id_add">模板名称</label>
                            <input style="width: 50%;" class="form-control" name="template_name" id="template_name" placeholder="请填写模板名称" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">模板别名</label>
                            <input style="width: 50%;" class="form-control" name="template_key" id="template_key" placeholder="请填写模板别名" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">模板类型</label>
                            <select name="type" id="type" style="width: 25%;"  class="form-control">
                            	<?php if (is_array($template_type) && count($template_type) > 0)
                                    foreach ($template_type as $type=>$type_name){?>
                            	      <option value="<?=$type?>"><?=$type_name?></option>
                            	<?php }?>
                            </select>
                        </div>
                        <div class="form-group" id="insert-fields">
                            <label for="tag_group_id_add">选项：</label><br/>
                            <?php if (is_array($config) && count($config) > 0)
                                foreach ($config as $configval){?>
                                    <?=$configval['config_title']?>:<a href="javascript:" data-val="<?=$configval['config_value']?>" class="config-class"><?='['.$configval['config_value'].']'?></a>&nbsp;&nbsp;
                            <?php }?>
                        </div>
                        <div class="form-group">
                            <label>内容</label>
                            <textarea style="width: 100%;height: 100px"  class="form-control" name="content" placeholder="请填写模板内容" id="content"></textarea>
                        </div>
                        <input name="sys_message_template_id" type="hidden" id="sys_message_template_id">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <a type="button" class="btn btn-primary ajax_post_tag">提交</a>
            </div>
        </div>
    </div>
</div>
<input value='<?=json_encode($template_type)?>' name="template_type" id="template_type" type="hidden">
<!-- 固定js -->
<script type="text/javascript" src="/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="/static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/plugins/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="/static/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript" src="/static/jBox/i18n/jquery.jBox-zh-CN.js"></script>
<!-- 自定义js -->
<script type="text/javascript" src="/static/app/global.js?version=<?=Yii::$app->params['version']?>"></script>
<script type="text/javascript" src="/static/app/sys-message-template/list.js?version=<?=Yii::$app->params['version']?>"></script>